package io;

import java.io.File;
import java.io.IOException;

public class IODemo4 {
    public static void main(String[] args) throws IOException, InterruptedException {
        // 文件删除
        File file = new File("./test.txt");

        boolean flag = file.delete();
        System.out.println(flag);

        // 文件退出时删除
        File file2 = new File("./test2.txt");
        flag = file2.createNewFile();
        System.out.println(flag);

        file2.deleteOnExit();
        Thread.sleep(3000);
    }
}
